package com.wjk.kylin.modules.system.notice.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.wjk.kylin.core.common.entity.BaseEntity;
import com.wjk.kylin.core.common.valid.insert;
import com.wjk.kylin.core.common.valid.update;
import lombok.Data;
import lombok.ToString;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;

/**
 * <p>
 * 通知表
 * </p>
 *
 * @author wangjkui
 * @since 2020-06-01
 */
@Data
@ToString
@TableName("sys_notice")
public class Notice extends BaseEntity<Notice> {

    /**
     * 类型
     */
    @TableField("type")
    private String type;

    /**
     * 标题
     */
    @NotBlank(message = "公告标题不能为空",groups = {insert.class})
    @Size(min = 0, max = 50, message = "公告标题不能超过50个字符",groups = {insert.class, update.class})
    @TableField("title")
    private String title;

    /**
     * 内容
     */
    @TableField("content")
    private String content;

    /** 公告状态（0正常 1关闭） */
    @TableField("status")
    @Pattern(regexp="^[0-1]",message = "状态只能为0或1",groups = {insert.class, update.class})
    private String status;

}
